const Sequelize = require('sequelize');
module.exports = function (sequelize, DataTypes) {
  return sequelize.define('ArticleTags', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      primaryKey: true
    },
    tagId: {
      field: 'tag_id',
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      comment: "标签表主键"
    },
    articleId: {
      field: 'article_id',
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      comment: "文章ID"
    },
    createdAt: {
      field: 'create_time',
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "添加时间"
    },
    updatedAt: {
      field: 'update_time',
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "更新时间"
    }
  }, {
    sequelize,
    tableName: 'content_article_tags',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
